<!-- 分类筛选 -->
<select id="select0">
    <option value="0" class="selects">全部</option>
    <volist name="gamefl" id="vo">
        <if condition="$vo['class_id'] == $parent_id">
            <option value="{$vo.class_id}" class="selects" selected="selected">{$vo.class_name}</option>
            <else />
            <option value="{$vo.class_id}" class="selects">{$vo.class_name}</option>
        </if>
    </volist>
</select>
<select id="select1">
    <empty name="gamefl2">
            <option value="0" class="selects1">--</option>
    <else />
        <volist name="gamefl2" id="vo">
            <if condition="$vo['class_id'] == $children_id">
                <option value="{$vo.class_id}" selected="selected">{$vo.class_name}</option>
                <else />
                <option value="{$vo.class_id}">{$vo.class_name}</option>
            </if>
        </volist>
    </empty>
</select>
<input type="hidden" name="cid" id="category-id" value="{$game.children_id}" />
<script type="text/javascript">
    $(function(){
        $('#select0').change(function(){
            var val = $("#select0").val();
            if(val == 0){
                $("#select1").html('<option value="0">--</option>');
                $('#category-id').val('');
                return ;
            }

            $.ajax({
                type:'POST',
                url:"{:U('Game/Lists', 'do=selectlist')}",
                data:{
                    list1: val,
                },
                success:function(data){
                    if( data.length > 0 ){
                        $("#select1").html('');
                        var fcid = '';
                        $.each(data, function(i, item) {
                            if( i == 0 ){
                                fcid = item.class_id;
                            }
                            $("#select1").append(
                                '<option value="'+item.class_id+'">'+item.class_name+'</option>'
                            );
                            $('#category-id').val(fcid);
                        });
                    }else{
                        $("#select1").html('<option value="0">--</option>');
                        $('#category-id').val('');
                    }
                }
            });
        });

        $('#select1').change(function(){
            var v = parseInt($(this).val());
            if( v > 0 )
                $('#category-id').val( v );
        });
    })
</script>